package com.xd.community.service;

import com.xd.community.mapper.FansMapper;
import com.xd.community.mapper.UserMapper;
import com.xd.community.model.entity.User;
import com.xd.community.service.Iservice.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * Demo class
 *
 * @author
 * @date 2016/10/31
 */
@Service
@Slf4j
public class UserServiceImpl implements IUserService, UserDetailsService {

  @Resource
  private UserMapper userMapper;

  @Override
  public User findUserOne(User user) {
    return userMapper.findUserOne(user);
  }

  @Override
  public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
    User user = new User();
    user.setName(s);
    if(user != null){
      log.info("logging ===>" + user.toString());
    }
    return user;
  }

}
